//import {Adapter_Impl}  from "./adapter_canvas2D"
import { BitMath } from "../math/math";

export module Adapter_Interface
{
    export interface IAudioAdapter
    {

    }
    //渲染适配器，需要由外部实现，作为一个渲染抽象，Tile系统就能不关心外部渲染层
    export interface IRenderAdapter
    {
        readonly viewwidth:number;
        readonly viewheight:number;
        //基本操作方法
        Clear(): void


        Flush(): void
        //创建贴图方法
        CreateWriteableTexture(palette: BitMath.OutPalette, width: number, height: number): ITexture_Writeable
        Draw(tex: ITexture| HTMLImageElement, srcrect: BitMath.Rect, x: number, y: number, colorIndexMultiply: number): void
        DrawScale(tex: ITexture | HTMLImageElement, srcrect: BitMath.Rect, destrect: BitMath.Rect, colorIndexMultiply: number): void
    }
    export interface ITexture
    {
        readonly width: number;
        readonly height: number;
        readonly bit: number;//32bit 还是8bit ，看是否支持Texture
        readonly palette: BitMath.OutPalette;//每个贴图有一个调色板，如果是8bit贴图，则适配层要硬件实现调色板，如果是32bit贴图，则适配层写入要做转换
        Close(): void;
    }
    export interface ITexture_Writeable extends ITexture
    {
        BeginWrite(x: number, y: number, w: number, h: number): void;
        Write8bitBlock(x: number, y: number, data: Uint8Array, datawidth: number): void;
        Write8bitPixel(x: number, y: number, colorIndex: number): void;
        EndWrite(): void;
    }

}

